package com.avic.modules.equipment.rest;

import com.avic.modules.equipment.service.EquipmentCategoryService;
import com.avic.modules.equipment.service.dto.EquipmentQueryCriteria;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;

/**
 * @author zhangzikang
 * @date 2022-08-14
 */
@Api(tags = "设备管理: 设备类别接口")
@RestController
@RequestMapping("/api/equipment/category")
@AllArgsConstructor
public class EquipmentCategoryController {

    private final EquipmentCategoryService categoryService;

    /**
     * 查看设备类别
     * @param criteria
     * @return
     */
    @ApiOperation("查看设备类别")
    @GetMapping
    public ResponseEntity<Object> getEquipmentCategory(EquipmentQueryCriteria criteria) throws ExecutionException, InterruptedException {
        return new ResponseEntity<>(categoryService.queryStation(criteria), HttpStatus.OK);
    }


    /**
     * 查看设备类别
     * @param criteria
     * @return
     */
    @ApiOperation("查看设备类别")
    @GetMapping("/all")
    public ResponseEntity<Object> getEquipmentCategoryAll(EquipmentQueryCriteria criteria){
        return new ResponseEntity<>(categoryService.queryAlls(criteria), HttpStatus.OK);
    }
}
